<%@page import="org.apache.http.HttpRequest"%>
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@include file="/WEB-INF/common/taglib.jsp"%>
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>后台管理登陆页面</title>

        <link href="${ctx}/static/admin/login/css/style.default.css" rel="stylesheet">
		<script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
		<script src="${ctx}/static/admin/login/js/jquery.md5.js"></script>
        <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!--[if lt IE 9]>
        <script src="${ctx}/static/admin/login/js/html5shiv.js"></script>
        <script src="${ctx}/static/admin/login/js/respond.min.js"></script>
        <![endif]-->
        <style type="text/css">
        	body {
			    background-color: #1fbda5;
			} 
			body.signin {
			    background-color: #1fbda5;
			}
			.panel-signin, .panel-signup {
			    margin: 100px auto 0 auto;
			}
        </style>
    </head>

    <body class="signin">
    	<section>
            
            <div class="panel panel-signin">
                <div class="panel-body">
                    <h4 class="text-center mb5">吃瓜内容管理系统</h4>
                    <p class="text-center">Sign in to your account</p>
                    
                    <div class="mb30"></div>
                    
                    <form action="signin.html" method="post">
                        <div class="input-group mb15">
                            <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                            <input type="text" class="form-control" id="username" name="username" placeholder="Username">
                        </div><!-- input-group -->
                        <div class="input-group mb15">
                            <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                            <input type="password" class="form-control" id="password" name="password" placeholder="Password">
                        </div><!-- input-group -->
                        
                        <div class="clearfix">
                            <div class="pull-left">
                                <div class="ckbox ckbox-primary mt10">
                                    <input type="checkbox" id="rememberMe" value="1">
                                    <label for="rememberMe">Remember Me</label>
                                </div>
                            </div>
                            <div class="pull-right">
                                <button  id="login" class="btn btn-success">Sign In <i class="fa fa-angle-right ml5"></i></button>
                            </div>
                        </div>                      
                    </form>
                    
                </div><!-- panel-body -->
                <!-- <div class="panel-footer">
                    <a href="signup.html" class="btn btn-primary btn-block">Not yet a Member? Create Account Now</a>
                </div> --><!-- panel-footer -->
            </div><!-- panel -->
            
        </section>
        <%-- <section>
            <div class="panel panel-signin">
                <div class="panel-body">
                    <div class="logo text-center">
                        <img src="${ctx}/static/admin/login/images/logo.png" alt="Chain Logo" >
                    </div>
                    <br />
                    <h4 class="text-center mb5">业务系统框架</h4>
                    
                    <div class="mb30"></div>
                    <form>
                        <div class="input-group mb15">
                            <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
                            <input type="text" class="form-control" name="username" value="admin" placeholder="用户名">
                        </div><!-- input-group -->
                        <div class="input-group mb15">
                            <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
                            <input type="password" class="form-control" name="password" value="admin" placeholder="密码">
                        </div><!-- input-group -->
                        <div class="clearfix">
                        	<button id="login" class="btn btn-success" style="width:100%">登陆</button>
                        </div>                      
                    </form>
                </div><!-- panel-body -->
            </div><!-- panel -->
        </section> --%>

        <script src="${ctx}/static/admin/login/js/jquery-1.11.1.min.js"></script>
        <script src="${ctx}/static/admin/login/js/jquery-migrate-1.2.1.min.js"></script>
        <script src="${ctx}/static/admin/login/js/bootstrap.min.js"></script>
        <script src="${ctx}/static/admin/login/js/modernizr.min.js"></script>
        <script src="${ctx}/static/admin/login/js/pace.min.js"></script>
        <script src="${ctx}/static/admin/login/js/retina.min.js"></script>
        <script src="${ctx}/static/admin/login/js/jquery.cookies.js"></script>
		<script src="${ctx}/static/admin/login/js/jquery.md5.js"></script>
        <script src="${ctx}/static/admin/login/js/custom.js"></script>
		<script>
			if(window.top != null && window.top != window) top.location.href = "login";
			$(function() {
				$("form").submit( function () {
				  return false;
				} );
				$('#login').bind('click',function(){
					$.post('login',{'username':$('#username').val(),'password':$.md5($('#password').val())},function(r){
						if(r.code<0) return showError(r);
						/* var ref = '';  
						 if (document.referrer.length > 0) {  
						  ref = document.referrer;  
						  console.log(ref)
						 }  
						 try {  
						  if (ref.length == 0 && opener.location.href.length > 0) {  
						   ref = opener.location.href;   console.log(ref)
						  }  
						 } catch (e) {} 
						 console.log(ref) */
						 top.location.href='index';
					},'json');
				});
			});
			
			function showError(r){
				console.log(r.msg)
			}
		</script>
    </body>
</html>
